package AppSystem;

import Data.SaveFeature;
import android.content.Context;
import android.content.SharedPreferences;
import tbs.littlebaby.R;

public class Settinger {
    static float ImageScale=0.5f;
    static  boolean autoread=false,LockImage=false;
    static  int imgId;

    public static float getImageScale() {
        return ImageScale;
    }

    public static boolean setImageScale(float imageScale) {
        if(imageScale>0&&imageScale<=1)
        {
            ImageScale = imageScale;
            return  true;
        }else
            return false;

    }

    public static boolean isLockImage() {
        return LockImage;
    }

    public static int getImgId() {
        return imgId;
    }

    public static void setImgId(int imgId) {
        Settinger.imgId = imgId;
    }

    public static void setLockImage(boolean lockImage) {
        LockImage = lockImage;
    }

    public static boolean isAutoread() {
        return autoread;
    }

    public static void setAutoread(boolean autoread) {
        Settinger.autoread = autoread;
    }

    public static  void ReadSetting(Context context)
   {
       SharedPreferences read=SaveFeature.SettingRead(context);
       ImageScale= read.getFloat("ImgScale",0.5f);
       autoread=read.getBoolean("AutoRead",false);
       LockImage=read.getBoolean("LockImage",false);
       imgId=read.getInt("imageID",R.mipmap.main);
   }

    public  static void  SaveSetting(Context context)
    {
       SharedPreferences.Editor editor= SaveFeature.SettingEditor(context);
       editor.putFloat("ImgScale",ImageScale);
       editor.putBoolean("AutoRead",autoread);
        editor.putBoolean("LockImage",LockImage);
        editor.putInt("imageID",imgId);
       editor.commit();
    }

}
